<!--
 * @Author: yan_hai_dong 891236760@qq.com
 * @Date: 2022-07-20 13:25:59
 * @LastEditors: yan_hai_dong 891236760@qq.com
 * @LastEditTime: 2022-10-17 10:29:22
 * @FilePath: \app\src\views\el\css\Layout.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div>
    <!-- <AspectRatio></AspectRatio> -->

    <div class="body">
      <div class="menus">
        <div class="menus-body">
          <div
            :class="{
              'ment-item': true,
              last: i == activeMenu - 1,
              active: i == activeMenu,
              next: i == activeMenu + 1,
            }"
            v-for="(item, i) in menus"
            :key="i"
            @click="activeMenu = i"
          >
            {{ item }}
          </div>
        </div>
      </div>
      <div class="main">main</div>
    </div>

    <div class="grid-box">
      <div class="item1">a</div>
      <div class="item2">b</div>
      <div class="item3">c</div>
    </div>

    <div class="box">
      <img src="@/assets/avatar.png" alt="" />
      哈哈gggg1bc11111bbcc1111111111111111111哈哈
      <p style="line-height: 24px">1111111111111111111111111</p>
    </div>

    <div class="grid">
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
      <div class="grid-item"></div>
    </div>
    <div class="flex">
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
      <div class="flex-item"></div>
    </div>
  </div>
</template>

<script>
// import AspectRatio from "./components/aspectRatio";
export default {
  components: {
    // AspectRatio,
  },
  data() {
    return {
      menus: [1, 2, 3, 4, 5],
      activeMenu: 4,
    };
  },
};
</script>

<style lang="less" scoped>
.body {
  display: flex;
  height: 400px;
  .menus {
    width: 100px;
    background-color: #ccc;
    .menus-body {
      background-color: #fff;
      .ment-item {
        height: 50px;
        background-color: #ccc;
        &:hover {
          cursor: pointer;
        }
        &.active {
          background-color: #fff;
          // & + .ment-item {
          //   border-top-right-radius: 10px;
          // }
          // & - .ment-item {
          //   border-top-right-radius: 10px;
          // }
        }
        &.last {
          border-bottom-right-radius: 10px;
        }
        &.next {
          border-top-right-radius: 10px;
        }
      }
    }
  }
  .main {
    flex: 1;
  }
}
.grid-box {
  border: 1px solid #ccc;
  height: 300px;
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: 140px 1fr;
  grid-gap: 15px 15px;
  grid-template-areas:
    "a a"
    "b c";
  > * {
    border: 1px solid red;
    height: 100px;
  }
  .item1 {
    grid-area: a;
  }
  .item2 {
    grid-area: b;
  }
  .item3 {
    grid-area: c;
  }
}
.box {
  border: 1px solid #ccc;
  img {
    // vertical-align: baseline; // 默认基线对齐
    vertical-align: bottom; // 1
    // display: inline-block;
  }
  // line-height: 0; // 2
  p {
    line-height: 24px;
    margin: 0;
  }
}
.grid {
  // width: 600px;
  display: grid;
  background: red;
  // grid-template-columns: repeat(4, 1fr);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-gap: 10px;
  .grid-item {
    background-color: #aaa;
    aspect-ratio: 1/1;
  }
}
.flex {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  background: #cccfff;
  .flex-item {
    box-sizing: border-box;
    width: calc((100% - 30px) / 4);
    aspect-ratio: 1/1;
    background-color: #aaa;
    &:not(:nth-child(4n)) {
      margin-right: 10px;
    }
    &:nth-child(n + 5) {
      margin-top: 10px;
    }
  }
}
</style>